package org.lmind.example.uc.webapp.action;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.lmind.example.uc.webapp.view.PageView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;

public abstract class AbstractController {
	
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@ExceptionHandler
	protected Object handlerException(Exception e) throws Exception {
		logger.warn("未捕获异常", e);
		throw e;
	}
	
	protected String urlEncode(String text) throws UnsupportedEncodingException {
		if (text == null)
			return "";
		return URLEncoder.encode(text, "utf-8");
	}
}
